<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增进度填报')"/>
    <th:block th:include="include :: bootstrap-fileinput-css" />
    <link rel="stylesheet" th:href="@{/jadeEasyUi/otherControls/layui/css/layui.css}">



    <link rel="stylesheet" th:href="@{/css/disinfection.css}">
    <style>
        div.layui-input-inline{
            background-color: #fff;
            height: 38px;
            line-height: 38px;
        }
        .container{
            width: 100%;
        }
        div.layui-input-inline select{
            display: block;
        }

        tr.info {
            background-color: #d9edf7;
        }
        tbody tr{
            text-align: center;
        }
        img{
            margin-top: 10px;
        }
        .file-caption-main{
            display: none;
        }
        .file-preview {
            border-radius: 5px;
            border: none;
            padding: 0px;
            width: 100%;
            /* margin-bottom: 5px; */
        }
        button.fileinput-remove,button.kv-file-remove,.krajee-default .file-footer-caption,span.file-drag-handle{
            display: none!important;
        }
        .file-drop-zone{
            border: none;
        }
        .krajee-default.file-preview-frame .file-thumbnail-footer {
            height: 35px;
        }

    </style>
</head>
<body class="white-bg">

<div class="container">
    <div class="container_row" >项目名称: <span th:text="${taskfill.projectName}"></span></div>

    <div class="layui-tab layui-tab-card">
        <ul class="layui-tab-title">
            <li class="layui-this">实施情况</li>
            <li>历史调度情况</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-elem-quote">
                    <h2>项目基本信息</h2>
                </div>
                <form class="layui-form" id="task-edit">
                    <input type="hidden" name="taskId" th:value="${taskfill.taskId}">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">调度任务期号:</label>
                            <div class="layui-input-inline" th:text="${taskfill.taskNum}">12356
                                <!--<input type="tel" name="phone" lay-verify="required|phone" autocomplete="off"-->
                                       <!--class="layui-input">-->

                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">填报截止时间:</label>
                            <div class="layui-input-inline" th:text="${#dates.format(taskfill.taskEndTime, 'yyyy-MM-dd')}">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">开工情况:</label>
                            <div class="layui-input-inline" th:with="type=${@dict.getType('task_level')}">
                                <p th:each="dict : ${type}" th:text="${dict.dictLabel}" th:if="${dict.dictValue eq taskfill.taskLevel}"></p>
                                <!--<select name="taskLevel"  class="form-control m-b" th:with="type=${@dict.getType('task_level')}">-->
                                    <!--<option value="">所有</option>-->
                                    <!--<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
                                <!--</select>-->
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">实际开工时间:</label>
                            <div class="layui-input-inline" th:text="${#dates.format(taskfill.projectStartTime, 'yyyy-MM-dd')}">

                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">建设单位:</label>
                            <div class="layui-input-inline" th:text="${taskfill.companyName}">

                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">形象进度:</label>
                            <div class="layui-input-inline" th:with="type=${@dict.getType('task_process')}"  >
                                    <p th:each="dict : ${type}" th:text="${dict.dictLabel}" th:if="${dict.dictValue eq taskfill.imageProcess}"></p>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item" style="height: 70px;line-height: 70px">
                        <div class="layui-block" >
                            <label class="layui-form-label" style="width: calc(100% - 78.5%) !important;height: 70px;line-height: 50px">进展情况:</label>
                        </div>
                        <div class="layui-inline" style="margin-left: 20px;width: calc(70% - 20px) !important;" th:text="${taskfill.taskInfo}">
                        </div>
                    </div>
                    <!--<div class="layui-form-item" style="height: 160px;">-->
                        <!--<div class="layui-block" >-->
                            <!--<label class="layui-form-label" style="width: calc(100% - 78.5%) !important;height: 160px;line-height: 100px">调度图片:</label>-->
                        <!--</div>-->
                        <!--<div class="layui-inline" style="margin-left: 20px;width: calc(70% - 20px) !important;">-->
                            <!--<img src="http://localhost/profile/upload/2020/08/08/0b107be4c3c4ecf2feef86d7ed0c5849.jpg" alt="">-->
                            <!--<img src="http://localhost/profile/upload/2020/08/08/0b107be4c3c4ecf2feef86d7ed0c5849.jpg" alt="">-->
                            <!--<img src="http://localhost/profile/upload/2020/08/08/0b107be4c3c4ecf2feef86d7ed0c5849.jpg" alt="">-->

                    <!--</div>-->
                    <!--</div>-->
                    <div class="layui-form-item" style="height: 250px;">
                        <div class="layui-block" >
                            <label class="layui-form-label" style="width: calc(100% - 78.5%) !important;height: 250px;line-height: 250px">调度图片:</label>
                        </div>
                        <div class="layui-inline" style="margin-left: 20px;width: calc(70% - 20px) !important;">

                            <div class="file-loading">
                                <input id="task_img" type="file" name="fileHandler" multiple>
                            </div>
                        </div>
                    </div>
                </form>
                <!--结束-->
            </div>
            <div class="layui-tab-item layui-show" style="margin-top: 30px">
                <div class="layui-elem-quote">
                    <h2>投资情况</h2>
                </div>
                <table class="table table-bordered table-hover">
                    <tr class="info">
                        <td>总投资（万元）</td>
                        <td>累计完成投资（万元）</td>
                        <td>本期完成投资（万元）</td>

                    </tr>
                    <tr>
                        <td  id="totalInvestment" th:text="${taskfill.totalInvestment}"></td>
                        <td  id="addInvestment" th:text="${taskfill.addInvestment}"></td>
                        <td  id="thisInvestment" th:text="${taskfill.thisInvestment}"></td>
                    </tr>
                </table>
            </div>
            <div class="layui-form-item" style="height: 70px;line-height: 70px;margin-top: 30px;">
                <div class="layui-block" >
                    <label class="layui-form-label" style="width: calc(100% - 78.5%) !important;height: 70px;line-height: 50px">问题填报:</label>
                </div>
                <div class="layui-inline" style="margin-left: 20px;width: calc(70% - 20px) !important;" th:text="${taskfill.taskSuggest}">
                </div>
            </div>

            <div class="layui-form-item" style="height: 70px;line-height: 70px;margin-top: 30px;">
                <div class="layui-block" >
                    <label class="layui-form-label" style="width: calc(100% - 78.5%) !important;height: 70px;line-height: 50px">审核意见:</label>
                </div>
                <div class="layui-inline" style="margin-left: 20px;width: calc(70% - 20px) !important;">
                    <textarea id="taskSuggest" class="form-control" style="border-color: #666;"></textarea>
                </div>
            </div>

            <div class="row" >
                <div class="col-sm-offset-5 col-sm-10">
                    <button id="btn1" type="button" class="btn btn-lg btn-primary" onclick="submitHandler(1)"><i class="fa fa-check"></i>通过</button>&nbsp;
                    <button id="btn2" type="button" class="btn btn-lg btn-warning" onclick="submitHandler(2)"><i class="fa fa-remove"></i>退回</button>&nbsp;
                    <button onclick="$.modal.close()" class="btn btn-lg btn-danger" type="button">关闭</button>

                </div>
            </div>
            <div class="layui-tab-item">2</div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-fileinput-js2" />
<script th:inline="javascript">
    var prefix = ctx + "linkong/fill";
    var taskImgPaths = [[${taskfill.taskImgPaths}]];

    var initPics = taskImgPaths == null?[]:taskImgPaths.split(",");
    // var initPics = taskImgPaths.split(",");
    $(document).ready(function () {
        $("#task_img").fileinput({
            'theme': 'explorer-fas',
            'uploadUrl': '#',
            overwriteInitial: false,
            initialPreviewAsData: true,
            allowedFileExtensions: ["jpg", "png", "jpeg"], //接收的文件后缀
            maxFileCount:3,

            initialPreview: initPics
        });
    });
    function submitHandler(flag){
        var taskResult = $("textarea#taskSuggest").val();
        if(taskResult == ''){
            return  $.modal.alertError("请填写审核意见");
        }
        var taskId = $("input[name='taskId']").val();
        $("#btn1").attr('disabled',true);
        $("#btn2").attr('disabled',true);
        var taskStatus = "";
        if(flag == 1){
            taskStatus = 2;
        }else if(flag == 2){
            taskStatus = 3;
        }
        var options = {
            type : "POST",
            url : prefix + "/applySubmit",
            data : {taskId:taskId,"taskResult":taskResult,"taskStatus":taskStatus},
            beforeSend: function(){
                $.modal.loading("正在处理中，请稍后...");
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }}
        $.ajax(options);

    }
</script>
</body>
</html>